# date:2021/10/13
# Author:Simin
names_1班 = ["A1","A2","A3"]
names_2班 = ["B1","B2"]

# 4.删除列表
# names.clear()
# print(names)

# 5.合并列表 extend 是有顺序的，（）里面的list排在后面
names_1班.extend(names_2班)
print(names_1班)

# 6.copy() 复制列表 这里的赋值不等于真正意义上的复制
# names_1班复制 = names_1班
# print(names_1班)
# print(names_1班复制)
# names_1班.append("xiaowu")
# print("names_1班：",names_1班)
# print("names_1班复制：",names_1班复制)

# 引入copy

# names_1班_源数据备份 = names_1班.copy()
# print(names_1班)
# print(names_1班_源数据备份)
# names_1班.append("555") #这里加的555是已经在（源数据备份）输出之后加的，所以不显示#
# print("names_1班：",names_1班)
# print("names_1班_copy:",names_1班_源数据备份)

# 用切片[:] 等价于 copy()方法
names_1班_源数据备份 = names_2班[:]
print(names_1班)
print(names_1班_源数据备份)
names_1班.append("55")
print("names_1班：",names_1班)
print("names_1班_源数据备份:",names_1班_源数据备份)


# 列表里的数可以是数字/字母（会变蓝，中文不行），加” “则为字符串
List = ['123', 'Facebook', 'Google', 'Runoob', 'Taobao']

# 7.count() 查看元素出现的次数/统计数量
print(List.count('123')) #统计'123'出现的次数#

# 8.sort() means排序 reverse(反转的意思)=True(条件为真) 从高到低，默认从低到高排序
List.sort(reverse=True)
print(List)

# 字符串排序方法是 ： 首字母的a-z顺序 #
names_1班.sort()
print(names_1班)